using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The TeacherContactTableManager class is responsible for managing BO.TeacherContactTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class TeacherContactTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all TeacherContactTable objects in the database.
/// </summary>
/// <returns>A list with all TeacherContactTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static TeacherContactTableList GetList(){
return TeacherContactTableDB.GetList();
}

/// <summary>
/// Gets a single TeacherContactTable from the database without its data.
/// </summary>
/// <param name="teacherContactKey">The TeacherContactKey of the TeacherContactTable in the database.</param>
/// <returns>A TeacherContactTable object when the TeacherContactKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TeacherContactTable GetItem(int teacherContactKey){
return GetItem(teacherContactKey, false);
}

/// <summary>
/// Gets a single TeacherContactTable from the database.
/// </summary>
/// <param name="teacherContactKey">The TeacherContactKey of the TeacherContactTable in the database.</param>
/// <param name="getTeacherContactTableRecords">Determines whether to load all associated TeacherContactTable records as well.</param>
/// <returns>
/// A TeacherContactTable object when the TeacherContactKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TeacherContactTable GetItem(int teacherContactKey, bool getTeacherContactTableRecords){
TeacherContactTable myTeacherContactTable = TeacherContactTableDB.GetItem(teacherContactKey);
return myTeacherContactTable;
}

[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TeacherContactTable GetItemByUserAccountKey(int UserAccountKey)
{
    TeacherContactTable myTeacherContactTable = TeacherContactTableDB.GetItemByUserAccountKey(UserAccountKey);
    return myTeacherContactTable;
}

/// <summary>
/// Saves a TeacherContactTable in the database.
/// </summary>
/// <param name="myTeacherContactTable">The TeacherContactTable instance to save.</param>
/// <returns>The new TeacherContactKey if the TeacherContactTable is new in the database or the existing TeacherContactKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(TeacherContactTable myTeacherContactTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int teacherContactTableTeacherContactKey = TeacherContactTableDB.Save(myTeacherContactTable);

//  Assign the TeacherContactTable its new (or existing TeacherContactKey).
myTeacherContactTable.TeacherContactKey = teacherContactTableTeacherContactKey;

myTransactionScope.Complete();

return teacherContactTableTeacherContactKey;
}
}

/// <summary>
/// Deletes a TeacherContactTable from the database.
/// </summary>
/// <param name="myTeacherContactTable">The TeacherContactTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(TeacherContactTable myTeacherContactTable){
return TeacherContactTableDB.Delete(myTeacherContactTable.TeacherContactKey);
}

#endregion

}

}
